package builders;

import users.LibrarianRole;
import users.Role;
import users.UserAccount;

/**
 * UserAccount builder.
 */
public class UserAccountBuilder implements IBuilderExampler<UserAccount> {

    private String userID;

    private String password;

    private Role role;

    public String getUserID() {
        return this.userID;
    }

    public void setUserID(final String userID) {
        this.userID = userID;
    }

    public String getPassword() {
        return this.password;
    }

    public void setPassword(final String password) {
        this.password = password;
    }

    public Role getRole() {
        return this.role;
    }

    public void setRole(final Role role) {
        this.role = role;
    }

    @Override
    public UserAccount build() {
        return new UserAccount(this);
    }

    public UserAccountBuilder withUserId(final String anId) {
        this.userID = anId;
        return this;
    }

    public UserAccountBuilder withPassword(final String pwd) {
        this.password = pwd;
        return this;
    }

    public UserAccountBuilder withRole(final Role aRole) {
        this.role = aRole;
        return this;
    }

    @Override
    public UserAccount example() {
        return new UserAccountBuilder().withPassword("1234").withUserId("userexample").withRole(new LibrarianRole())
                .build();
    }

}
